package cn.jbolt.admin.xd.utils;

import cn.jbolt.common.model.xd.XdScmCustomer;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileInputStream;

public class CustomerUtils {

    public static void main(String[] args) {
        XdDBUtils.contect();
        customerImport();
    }

    private static void customerImport(){
        try {
            String path = "/Users/weizixiong/Downloads/客户列表-20250713022519382.xlsx";
            FileInputStream fileInputStream = new FileInputStream(path);

            XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
            Sheet sheet = workbook.getSheetAt(0);
            for (int i = 2; i < sheet.getPhysicalNumberOfRows(); i++) {
                //获取第一行
                Row row = sheet.getRow(i);
                String name = row.getCell(1).getStringCellValue();
                System.out.println(i + "===" + name);

                XdScmCustomer customer = new XdScmCustomer();
//                customer.setTeamId(1944080693757669376L);
                customer.setTeamId(1944080649646174208L);
                customer.setName(name);
                customer.save();

            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
